package ThreadPool.Instance;

public class HongBao {
    private int money;

    public HongBao(int money) {
        this.money = money;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }


    public synchronized void getHongBao() {
        String name = Thread.currentThread().getName();
        if (money < 31) {
            System.out.println(name + "-抢红包成功！抢到红包：" + money);
        } else if (money <= 100) {
            System.out.println(name + "-抢红包成功！抢到红包：" + money);
        }
    }
}

